var e = require("../@babel/runtime/helpers/typeof");

module.exports = {
    formatDate: function(t, s) {
        if (t) {
            switch (s || (s = "yyyy-MM-dd"), e(t)) {
              case "string":
                t = new Date(t.replace(/-/g, "/"));
                break;

              case "number":
                t = new Date(t);
            }
            if (t instanceof Date) {
                var r = {
                    yyyy: t.getFullYear(),
                    M: t.getMonth() + 1,
                    d: t.getDate(),
                    H: t.getHours(),
                    m: t.getMinutes(),
                    s: t.getSeconds(),
                    MM: ("" + (t.getMonth() + 101)).substr(1),
                    dd: ("" + (t.getDate() + 100)).substr(1),
                    HH: ("" + (t.getHours() + 100)).substr(1),
                    mm: ("" + (t.getMinutes() + 100)).substr(1),
                    ss: ("" + (t.getSeconds() + 100)).substr(1)
                };
                return s.replace(/(yyyy|MM?|dd?|HH?|ss?|mm?)/g, function() {
                    return r[arguments[0]];
                });
            }
        }
    }
};